package com.zlc.workflow.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

@Getter
@AllArgsConstructor
public enum TaskOperateTypeEnum {

    SUBMIT("SUBMIT", "提交"),
    AUTO_SUBMIT("AUTO_SUBMIT", "自动处理"),
    REJECT("REJECT", "退回"),
    TERMINATION("TERMINATION", "终止"),
    NODE("NODE", "备案"),
    ;
    private String type;
    private String desc;


    public static TaskOperateTypeEnum getType(String type) {
        TaskOperateTypeEnum[] types = values();
        for (TaskOperateTypeEnum operateType : types) {
            if (operateType.type.equals(type)) {
                return operateType;
            }
        }
        return null;
    }

    public static String getOperateTypeName(String status) {
        TaskOperateTypeEnum typeEnum = getType(status);
        return Objects.nonNull(typeEnum) ? typeEnum.getDesc() : null;
    }
}
